package com.example.week2_intent;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;

public class ImageActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_image);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_image, menu);
		return true;
	}
	
	public void setImage(View v){
		Intent data = new Intent();
		
		ImageView image = 	(ImageView) v;
		
		int src = 0;
		switch(v.getId()){
		case R.id.imageView1:
			src = R.drawable.ic_launcher;
			break;
		case R.id.imageView2:
			src=android.R.drawable.stat_sys_phone_call;
			break;
		
		case R.id.imageView3:
			src=android.R.drawable.ic_menu_info_details;
			break;
		
		}
		
		data.putExtra("img", src);
		setResult(2000, data);
		
		finish();
	}

}
